/**
 * Created with Intellij IDEA.
 * Description:
 * User: wangj
 * Date: 2022-02-11
 * Time: 2:22
 */
public class TestDemo {
    public static void main(String[] args) {
        int[] arr={1,3,5,7,9,0,2,4,6,8};
        int count= arr.length;
        System.out.print("before ");
        for (int i = 0; i < count; i++) {
            System.out.print(arr[i]);
        }
        System.out.println();
        System.out.print("after ");
        for (int i = 0; i < count-1; i++) {
            for (int j = 0; j < count-i-1; j++) {
                if(arr[j]>arr[j+1]) {
                   int tmp=arr[j];
                   arr[j]=arr[j+1];
                   arr[j+1]=tmp;
                }
            }
        }
        for (int i = 0; i < count; i++) {
            System.out.print(arr[i]);
        }
    }
}
